home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr28 / charon40.zip / SRC / FILTNONE.C < prev    next >
Text File  |  1993-03-01  |  835b  |  46 lines

  1. /* filtnone -- does nothing */
  2. #include <string.h>
  3. #include <time.h>
  4. #define    STANDALONE    0
  5. #include "callback.h"
  6.  
  7. char    *stackinfo="$STACKSIZE:2048";
  8.  
  9. #define    BUFFSIZE    1024
  10.  
  11. int
  12. main(int argc, char *argv[])
  13. {
  14.  
  15.     char    buff[BUFFSIZE];
  16.     int    x, eof;
  17.     long    start, end;
  18.     long    bytes = 0;
  19.  
  20.     buff[0] = 0;
  21.  
  22.     for(x = 0; x < argc; x++) {
  23.                char    tbuff[32];
  24.  
  25.                sprintf(tbuff,"%d(%s) ",x,argv[x]);
  26.         strcat(buff,tbuff);
  27.     }
  28.     strcat(buff,"\n");
  29.     write(STDERR,buff,strlen(buff));
  30.     eof = 0;
  31.     time(&start);
  32.     while(!eof) {
  33.         x = read(STDIN,buff, BUFFSIZE);
  34.         if(x == -1)
  35.                    break;
  36.         if(x < BUFFSIZE)
  37.                    eof = 1;
  38.         bytes += x;
  39.         write(STDOUT, buff, x);
  40.        }
  41.     time(&end);
  42.     fprintf(STDERR,"copied %ld bytes in %d seconds\n",bytes, (int) end-start);
  43.     return(RT_OK|RT_CHANGED_TEXT);
  44. }
  45.  
  46.